﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace FitnessHelperDesktopClient
{
  /// <summary>
  /// Служит для отображения времени в календаре
  /// </summary>
  [ValueConversion(typeof(DateTime), typeof(string))]
  class CalendarRecordsConverter : IValueConverter
  {
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
      if (null == value)
      {
        return string.Empty;
      }

      var time = (DateTime)value;
      return time.ToString("HH:mm");
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
      throw new NotImplementedException();
    }
  }
}
